<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="allos.html" />
<link rel="prev" href="archiving.html" />
<link rel="parent" href="lib.html" />
<link rel="next" href="module-pickle.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>13. Data Persistence</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="12.5.3 Examples"
  href="tar-examples.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="Python library Reference"
  href="lib.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="13.1 pickle  "
  href="module-pickle.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="tar-examples.html">12.5.3 Examples</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="lib.html">Python Library Reference</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-pickle.html">13.1 pickle  </a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h1><a name="SECTION0015000000000000000000"></a>
<a name="persistence"></a>
<br>
13. Data Persistence
</h1>

<p>
The modules described in this chapter support storing Python data in a
persistent form on disk.  The <tt class="module">pickle</tt> and <tt class="module">marshal</tt>
modules can turn many Python data types into a stream of bytes and
then recreate the objects from the bytes.  The various DBM-related
modules support a family of hash-based file formats that store a
mapping of strings to other strings.  The <tt class="module">bsddb</tt> module also
provides such disk-based string-to-string mappings based on hashing,
and also supports B-Tree and record-based formats.

<p>
The list of modules described in this chapter is:

<p>
<table class='synopsistable' valign='baseline'>
  <tr class='oddrow'>
      <td><b><tt class='module'><a href='module-pickle.html'>pickle</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Convert Python objects to streams of bytes and back.</td></tr>
  <tr><td><b><tt class='module'><a href='module-cPickle.html'>cPickle</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Faster version of <tt class="module"><a href="module-pickle.html">pickle</a></tt>, but not subclassable.</td></tr>
  <tr class='oddrow'>
      <td><b><tt class='module'><a href='module-copyreg.html'>copy_reg</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Register <tt class="module">pickle</tt> support functions.</td></tr>
  <tr><td><b><tt class='module'><a href='module-shelve.html'>shelve</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Python object persistence.</td></tr>
  <tr class='oddrow'>
      <td><b><tt class='module'><a href='module-marshal.html'>marshal</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Convert Python objects to streams of bytes and back
                (with different constraints).</td></tr>
  <tr><td><b><tt class='module'><a href='module-anydbm.html'>anydbm</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Generic interface to DBM-style database modules.</td></tr>
  <tr class='oddrow'>
      <td><b><tt class='module'><a href='module-whichdb.html'>whichdb</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Guess which DBM-style module created a given database.</td></tr>
  <tr><td><b><tt class='module'><a href='module-dbm.html'>dbm</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>The standard ``database'' interface, based on ndbm.</td></tr>
  <tr class='oddrow'>
      <td><b><tt class='module'><a href='module-gdbm.html'>gdbm</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>GNU's reinterpretation of dbm.</td></tr>
  <tr><td><b><tt class='module'><a href='module-dbhash.html'>dbhash</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>DBM-style interface to the BSD database library.</td></tr>
  <tr class='oddrow'>
      <td><b><tt class='module'><a href='module-bsddb.html'>bsddb</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Interface to Berkeley DB database library</td></tr>
  <tr><td><b><tt class='module'><a href='module-dumbdbm.html'>dumbdbm</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>Portable implementation of the simple DBM interface.</td></tr>
  <tr class='oddrow'>
      <td><b><tt class='module'><a href='module-sqlite3.html'>sqlite3</a></tt></b></td>
      <td>&nbsp;</td>
      <td class='synopsis'>A DB-API 2.0 implementation using SQLite 3.x.</td></tr>
</table>

<br>
<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="12.5.3 Examples"
  href="tar-examples.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="Python library Reference"
  href="lib.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="13.1 pickle  "
  href="module-pickle.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="tar-examples.html">12.5.3 Examples</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="lib.html">Python Library Reference</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-pickle.html">13.1 pickle  </a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
